import http from '../utils/http.js';
import { myFectch } from '../utils/useFetch.js';
//加盟列表
function ShowFranchiseePage() {
    return http({
        method: 'post',
        url: '/franchisee/selectFranchiseeAllByPage',
        params:{
            page:1,
            limit:100
        }
    }).then((req) => {
        // console.log(req);
        return req
    }).catch((err) => {
        return err
    })
};
// 结账列表
function SelectFinance() {
    return http({
        method: 'post',
        url: '/financeSettlement/selectFinanceSettlementAllByPage',
        params:{
            page:1,
            limit:5
        }
    }).then((req) => {
        // console.log(req);
        return req
    }).catch((err) => {
        return err
    })
}
//加盟商添加
function AndUpdateFranchisee (obj) {
    return myFectch({
        url:'/franchisee/insertAndUpdateFranchisee',
        method:'post',
        headers:'application/json',
        data:{
            storeAddress:obj.storeAddress,
            franchiseeName:obj.franchiseeName,
            contactsName:obj.contactsName,
            contactsPhone:obj.contactsPhone,
            status:obj.status,
            commissionRate:obj.commissionRate
        }
    }).then((req) => {
        console.log(req);
        return req
    }).catch((err) => {
        return err
    })
}
function xiugai (obj) {
    return myFectch({
        url:'/franchisee/insertAndUpdateFranchisee',
        method:'post',
        headers:'application/json',
        data:{
            storeAddress:obj.storeAddress,
            franchiseeName:obj.franchiseeName,
            contactsName:obj.contactsName,
            contactsPhone:obj.contactsPhone,
            status:obj.status,
            commissionRate:obj.commissionRate,
            id:1
        }
    }).then((req) => {
        console.log(req);
        return req
    }).catch((err) => {
        return err
    })
}

export {
    ShowFranchiseePage,
    SelectFinance,
    AndUpdateFranchisee,
    xiugai
}